<?php

namespace app\service;

// 基础服务类
use app\model\Base as BaseModel;

class Base
{
    //定义数据返回格式
    public function returnData($code = 1, $msg = 'ok', $data = []): array
    {
        return [
            'code' => $code,
            'msg' => $msg,
            'data' => $data
        ];
    }



    //处理模型数据 去除多余字段
    public function handleModelData(BaseModel $model_data, $field = ['created_at','updated_at','deleted_at']): BaseModel
    {
        $model_data->hidden($field);
        return $model_data;
    }



}